package com.hxl.demo.controller;

import com.hxl.demo.entity.Leave;
import com.hxl.demo.entity.TrainingRecord;
import com.hxl.demo.entity.User;
import com.hxl.demo.mapper.LeaveMapper;
import com.hxl.demo.mapper.TrainingContentsMapper;
import com.hxl.demo.mapper.TrainingRecordMapper;
import com.hxl.demo.mapper.UserMapper;
import com.hxl.demo.service.Impl.LeaveServiceImpl;
import com.hxl.demo.service.Impl.TrainingRecodeServiceImpl;
import com.hxl.demo.tools.Common;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 数据更新
 */
@RestController
@RequestMapping("/admin")
public class LeaveController {
    @Resource
    private LeaveServiceImpl leaveServiceImpl;

    @Resource
    Leave leave;

    @RequestMapping("/leaveList")
    public Object leaveList(
            @RequestParam(name = "limit",required = false) Integer limit,
            @RequestParam(name = "page",required = false) Integer page,
            @RequestParam(name = "id",required = false) Integer id
                           ){

        List<Leave> list= leaveServiceImpl.leaveList(page,limit,id);
        Integer total=leaveServiceImpl.leaveNum(id);
        return Common.returnJsonList("操作成功",200,list,total);

        }

}
